package cn.edu.ujn.service;

import cn.edu.ujn.dao.DeviceInfo;
import cn.edu.ujn.dao.DeviceInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DeviceInfoServiceImpl implements IDeviceInfoService {
    @Autowired
    private DeviceInfoMapper deviceInfoMapper;
    @Override
    public int addDevice(DeviceInfo deviceInfo) {
        return deviceInfoMapper.insertDeviceInfo(deviceInfo);
    }

    @Override
    public int modifyDevice(DeviceInfo deviceInfo) {
        return deviceInfoMapper.updateDeviceInfo(deviceInfo);
    }

    @Override
    public int removeDevice(int deviceId) {
        return deviceInfoMapper.deleteDeviceInfo(deviceId);
    }

    @Override
    public DeviceInfo getDeviceById(int deviceId) {
        return deviceInfoMapper.selectDeviceInfoById(deviceId);
    }

    @Override
    public List<DeviceInfo> getAllDevices() {
        return deviceInfoMapper.selectAllDevices();
    }
}
